using System;
using System.Diagnostics;

namespace Jarvis.Server.Domain
{
    public class ExecuteProgramAction : Action
    {
        public virtual string CommandString { get; set; }

        public virtual string ExecuteInDirectory { get; set; }

        public virtual string Arguments { get; set; }

        #region Overrides of Action

        public override void Execute()
        {
            var proc = new Process { StartInfo =
                                         {
                                             FileName = CommandString,
                                             WorkingDirectory = ExecuteInDirectory,
                                             Arguments = this.Arguments
                                         } 
            };

            proc.Start();
        }

        #endregion
    }
}